package cn.edu.abtu.controller;

import cn.edu.abtu.service.FileService;
import cn.edu.abtu.utils.AjaxResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/oss/file")
public class OSSController {


    @Resource
    private FileService fileService;

    @PostMapping("/upload")
    public AjaxResult upload(MultipartFile file) {
        String url = fileService.upload(file);
        return AjaxResult.success("文件上传成功", url);
    }

}
